package com.xinqi.xinqidev.publisher.consumer.listeners;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author xin麒
 * @date 2023/11/16 12:02
 */
@Slf4j
@Component
public class MqListener {

    @RabbitListener(queues = "xinqiTopic.queue1")
    public void listenWorkQueue1(String msg) throws InterruptedException {
        log.debug("消费者1 监听【xinqiTopic.queue1】队列，拿到消息："+"【"+msg+"】");
    }

    @RabbitListener(queues = "xinqiTopic.queue2")
    public void listenWorkQueue2(String msg) throws InterruptedException {
        log.debug("消费者2 监听【xinqiTopic.queue2】队列，拿到消息："+"【"+msg+"】");
    }

/**
 * 11-19 17:45:36:449 DEBUG 3236 --- [ntContainer#0-1] c.x.x.p.consumer.listeners.MqListener    : 消费者1 监听【xinqiTopic.queue1】队列，拿到消息：【这是中国新闻】
 * 11-19 17:45:36:449 DEBUG 3236 --- [ntContainer#1-1] c.x.x.p.consumer.listeners.MqListener    : 消费者2 监听【xinqiTopic.queue2】队列，拿到消息：【这是中国新闻】
 * 11-19 17:45:36:450 DEBUG 3236 --- [ntContainer#1-1] c.x.x.p.consumer.listeners.MqListener    : 消费者2 监听【xinqiTopic.queue2】队列，拿到消息：【日本新闻】
 * 11-19 17:45:36:450 DEBUG 3236 --- [ntContainer#0-1] c.x.x.p.consumer.listeners.MqListener    : 消费者1 监听【xinqiTopic.queue1】队列，拿到消息：【今天天气挺不错，我的心情的挺好的】
 */
}
